#pragma once
#include "prio_assign.h"
#include "map"
namespace fs = std::filesystem;

class LPAS: public PriorityAssignAlgorithm {
public:
    LPAS(flow *flows) : PriorityAssignAlgorithm(flows) {}
    ~LPAS() = default;
	void run() override;
	void debug_flows() override;
	void record_flows(string path);
	void continuous_record(string path);
    void separate_ep_flows();
private:
    void assign_flow(const int id, const int priority, bool is_scheduled = true);
    void Reassign_priority(int vm, int old_prio, int cur_lpa_prio, u64 cost);
	void LPR();
	u64 min_cost, average_load;
	int queue_num;
	vector<vector<int>> map_queue;
	vector<u64> queue_load;
	flow temp[FLOW_MAX_NUM];
	map<int, vector<int>> qid2fid;
};